<?php

class ClientNewController extends \BaseController {

	protected $layout = 'index';
	
	/* === VIEW === */
	public function index()
	{
		$data = array(
				'client2s' 	=> Client2::orderBy('id', 'desc')->get()
		);
	
		$this->layout->content = View::make('clients.index2', $data);
	}
	public function create()
	{
		return View::make('clients.create_new'); //網頁位置
	}	
	public function store()
	{

		if( Request::ajax() )
	    {
			$data = array(
						'errors' 	=> $validator->errors(),
						'inputs'	=> Input::all()
			);
	
			return View::make('clients.create_new', $data);
		}
	
		$data = array(
				'client2s' 	=> Client2::orderBy('id', 'desc')->get(),
				'refresh'	=> true
		);
	
		return View::make('clients.table', $data);
	}	
}